{% extends "LololSuperAdminBundle::layout.html.twig" %} 

{% block javascripts %}
    {{ parent() }}

	<script type="text/javascript">
	function checkAll(checked) {
		$('.chkChampion').prop('checked', checked);
	}

	$(document).ready(function() {
	  $('.selectAll').on('click', function() { checkAll(true); return false;});
	  $('.unselectAll').on('click', function() { checkAll(false); return false;});

	  $('.btn-clear').on('click', function() { return confirm('Are you sure you want to clear the retrieved files?');});
	});
	
	</script>
{% endblock %}

{% block lolol_main %}
	<form method="POST" action="{{ path('lolol_super_admin_retrieveProcess') }}">
	<div class="row">
		<div class="col-xs-2">
			<div class="btn-group checkbox">
			  	<label><input type="checkbox" id="stats" name="retrieveTypes[]" value="stats" checked="true" />Stats</label>
			</div>
		</div>
		<div class="col-xs-2">
			<div class="btn-group checkbox">
			  	<label><input type="checkbox" id="icons48" name="retrieveTypes[]" value="icons48" checked="true" />Icons 48px</label>
			</div>
		</div>
		<div class="col-xs-2">
			<div class="btn-group checkbox">
			  	<label><input type="checkbox" id="icons20" name="retrieveTypes[]" value="icons20" checked="true" />Icons 20px</label>
			</div>
		</div>
	</div>
	
	<button class="btn btn-default selectAll"><i class="fa fa-check-square-o"></i> Select all</button>
	<button class="btn btn-default unselectAll"><i class="fa fa-square-o"></i> Unselect all</button>
	<button class="btn btn-primary" name="btnRetrieve" value="retrieve"><i class="fa fa-download"></i> Retrieve</button>
	<button class="btn btn-danger btn-clear" name="btnRetrieve" value="clear"><i class="fa fa-trash-o"></i> Clear</button>
	<br /><br />
	<table class="table table-bordered table-condensed">
	<thead>
		<tr>
			<th></th>
			<th>Name</th>
			<th>Stats</th>
			<th>Icon 48px</th>
			<th>Icon 20px</th>
		</tr>
	</thead>
	<tbody>
		{% for championInfo in championInfos %}
		<tr class="{{ championInfo.trClass }}">
			<td class="text-center"><input class="chkChampion" type="checkbox" id="{{ championInfo.name }}" name="champions[]" value="{{ championInfo.name }}" checked="true" /></td>
			<td><label for="{{ championInfo.name }}">{{ championInfo.name }}</label></td>
			<td><label for="{{ championInfo.name }}">{{ championInfo.lastStatsRetrieve }}</label></td>
			<td><label for="{{ championInfo.name }}">{{ championInfo.lastIcons48Retrieve }}</label></td>
			<td><label for="{{ championInfo.name }}">{{ championInfo.lastIcons20Retrieve }}</label></td>
		</tr>
		{% else %}
		<tr>
			<td colspan="3">No champions found</td>
		</tr>
		{% endfor %}	
	</tbody>
	</table>

	<button class="btn btn-default selectAll"><i class="fa fa-check-square-o"></i> Select all</button>
	<button class="btn btn-default unselectAll"><i class="fa fa-square-o"></i> Unselect all</button>
	<button class="btn btn-primary" name="btnRetrieve" value="retrieve"><i class="fa fa-download"></i> Retrieve</button>
	<button class="btn btn-danger btn-clear" name="btnRetrieve" value="clear"><i class="fa fa-trash-o"></i> Clear</button>
	</form>
{% endblock %}

